package org.ioc.com.book7.model;

import lombok.Data;
import org.ioc.com.book7.enums.ResultStatus;

@Data
public class Result<T> {
    private ResultStatus code;//业务码,和状态码不同.指的是请求成功后对结果按照一个业务码返回
    private String EssMsg;
    private T data;

    public static <T> Result sucess(T data){
        Result result=new Result();
        result.setCode(ResultStatus.SUCESS);
        result.setData(data);
        return result;
    }

    public static <T> Result fail(String essMsg){
        Result result=new Result();
        result.setCode(ResultStatus.FAIL);
        result.setEssMsg("出错了");
        return result;
    }
    public static <T> Result noLogin(){
        Result result=new Result();
        result.setCode(ResultStatus.NOLOGIN);
        result.setEssMsg("出错了");
        return result;
    }
}
